box gadget: Deal with optional arguments
authorMatthias Clasen <mclasen@redhat.com>
Mon, 18 Jan 2016 00:48:40 +0000 (19:48 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 18 Jan 2016 00:48:40 +0000 (19:48 -0500)
The baseline arguments to the preferred size callback can
be NULL. Don't crash if they are.

gtk/gtkboxgadget.c

index e02c8e301c4c48fd78a597cff06279a63d549c3e..f62b0d78976c1d5fda720097db37dbcccf0f7a08 100644 (file)
@@ -238,8 +238,10 @@ gtk_box_gadget_measure_opposite (GtkCssGadget   *gadget,
       total_min = MAX (total_min, above_min + below_min);
       total_nat = MAX (total_nat, above_nat + below_nat);
       /* assume GTK_BASELINE_POSITION_CENTER for now */
-      *minimum_baseline = above_min + (total_min - (above_min + below_min)) / 2;
-      *natural_baseline = above_nat + (total_nat - (above_nat + below_nat)) / 2;
+      if (minimum_baseline)
+        *minimum_baseline = above_min + (total_min - (above_min + below_min)) / 2;
+      if (natural_baseline)
+        *natural_baseline = above_nat + (total_nat - (above_nat + below_nat)) / 2;
     }
 
   *minimum = total_min;